package com.mx.project.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

@Configuration
public class SessionConfig {
    /**
     * 解决跨域问题!  SameSite=Lax  https://blog.csdn.net/qq_37060233/article/details/86595102
     * @return
     */
    @Bean
    public CookieSerializer httpSessionIdResolver(){
        DefaultCookieSerializer   cookieSerializer = new DefaultCookieSerializer();                            cookieSerializer.setCookieName("token");
        cookieSerializer.setUseHttpOnlyCookie(false);
        cookieSerializer.setSameSite(null);
        return cookieSerializer;
    }
}
